﻿using OctoOS.UI;
using OctoOS;
using System.Web.UI;

/// <summary>
/// Summary description for BaseArticlePreview
/// </summary>
public class BaseArticleUIPreview : Image48ObjectPreview
{
	bool _featured;

	public BaseArticleUIPreview(bool featured)
	{
		_featured = featured;
	}

	protected override void Render(HtmlTextWriter writer)
	{
		writer.WriteBeginTag("ul");
		{
			string ulClass = GetULClass();
			if(null == ulClass)
				ulClass = string.Empty;
			else if(0 < ulClass.Length)
				ulClass = " " + ulClass;

			if(_featured)
				writer.WriteAttribute("class", "oos_preview" + ulClass + " featured");
			else
				writer.WriteAttribute("class", "oos_preview" + ulClass);

			if(!string.IsNullOrEmpty(ID))
				writer.WriteAttribute("id", ClientID, true);
			writer.Write(HtmlTextWriter.TagRightChar);

			HtmlUtility.WriteFullBeginTagAndClass(writer, "li", "oos_previewSide");
			RenderSidePanelContent(writer);
			writer.WriteEndTag("li");

			/*if(offsetRequired)
			{
				writer.WriteBeginTag("div");
				writer.WriteAttribute("style", "margin-left:" + (ImageWidth + 5) + "px");
				writer.Write(HtmlTextWriter.TagRightChar);
			}*/

			// Render header
			if(!string.IsNullOrEmpty(HeaderText))
			{
				HtmlUtility.WriteFullBeginTagAndClass(writer, "li", "oos_previewHeader");
				{
					RenderHeaderContent(writer);
				}
				writer.WriteEndTag("li");
			}

			// Render body
			HtmlUtility.WriteFullBeginTagAndClass(writer, "li", "oos_previewBody");
			RenderBodyContent(writer);
			writer.WriteEndTag("li");

			// Render footer
			HtmlUtility.WriteFullBeginTagAndClass(writer, "li", "oos_previewFooter");
			RenderFooterContent(writer);
			writer.WriteEndTag("li");

			//if(offsetRequired)
			//	writer.WriteEndTag("div");
		}
		writer.WriteEndTag("ul");
	}
}